1. Field of the Invention
The present invention relates to a microcomputer system which includes a mechanism for controlling an operating sequence of a program.
2. Description of the Related Art
A program configured on a subroutine built in the known microcomputer operates to start a subroutine operation in response to a subroutine instruction or an interrupt instruction or it returns to a main routine in response to a return instruction.
The microcomputer known by the inventors of the present application is arranged to have as main components an arithmetic and logic unit, an accumulator, a program counter, a stack pointer, a stack, a program memory (ROM), a fetch circuit, and an interrupt controller. The program executed by the known microcomputer operates in the sequence of Start, address a, address c, address d, and END. That is, at the Start location, a main routine is executed. At the address a, the subroutine instruction takes place. Then, the operation jumps to the address b to which a jump instruction orders the operation to jump. One or more subroutines are executed from the addresses b to c. At the address c where the return instruction specifies, the operation returns to the address d which the main routine occupies. Then, the main routine is executed until it receives the END instruction.
That is, the data is moved with the center of the program counter PC as follows. EQU PC.rarw.PC+X(X=1, 2 . . .)
Assuming that SP denotes the stack pointer, STACK denotes the stack, and J denotes a destination address to which the program jumps, If the subroutine call instruction signal CALL or an interrupt instruction signal INT takes place, the operations are executed as follows.
SP .rarw.SP-1 PA1 STACK .rarw.PC PA1 PC.rarw.J PA1 PC .rarw.STACK PA1 SP .rarw.SP+1
Since J is entered into the program counter PC, the next program execution is accessed at the address J of the ROM.
A return operation from the known subroutine is executed as follows in response to the return instruction signal RTN given from the subroutine.
The address before the subroutine call, saved in the STACK, is returned to the program counter PC. The operation returns to a main routine. These operations are executed in the known program.
In the known program, if a subroutine program is too long, to allow the main routine to make sure of monitoring an event, it is necessary to divide the subroutine program into several short subroutine parts. Thus, the subroutine program is often returning the to the main routine. Further, the program is required to be created in consideration of prediction of a frequency of an event to be monitored and an execution time under the specific condition given by each subroutine. As mentioned above, when creating the subroutine program, it is necessary to take a troublesome step of predicting frequencies of all the event signals used in the system. It means that an event whose frequency is unpredictable or uncertain cannot be built in the program without having to use an interrupt function.